#pragma once

#include "../TdsReqHandler.h"
#include <bondlib/BondInfo.h>

class TfSimilarBondHandler : public TdsCmdHandler
{
Q_OBJECT
public:
    Q_INVOKABLE  TfSimilarBondHandler():TdsCmdHandler(kLocalReq) {}
    bool processCmd(const QJsonObject& cmdObj, const ReqInfo& reqinfo, bool unReg = false) override;

private:
	bool isSimiBond(CBondInfo* pBi);
	enum MatyrityType
	{
		MatyrityType_Non,
		MatyrityType_3M,
		MatyrityType_6M,
		MatyrityType_9M,
		MatyrityType_1Y,
		MatyrityType_2Y,
		MatyrityType_3Y,
		MatyrityType_5Y,
		MatyrityType_7Y,
		MatyrityType_10Y,
		MatyrityType_15Y,
		MatyrityType_20Y,
		MatyrityType_30Y,
		MatyrityType_50Y,
	};
	MatyrityType getSourceMaturityType(const CBondInfo* pBi);
	MatyrityType getSimiMaturityType(const CBondInfo* pBi);
private:
	std::shared_ptr<CBondInfo> m_BondInfo;
	MatyrityType m_MatyrityType;
};
